namespace Brjnk.GpxExplorer.Workspace
{
    using System;
    using System.Windows.Media;
    using Brjnk.GpxExplorer.Workspace.Searching;

    /// <summary>
    /// </summary>
    public class DateTimeFromClipboard : ItemFromClipboard
    {
        private DateTime dateTime;

        public DateTimeFromClipboard(DateTime dateTime)
        {
            this.dateTime = dateTime;
        }

        public DateTime DateTime { get { return dateTime; } }

        private bool search;

        public bool Search
        {
            get { return search; }
            set { search = value; OnPropertyChanged("Search"); }
        }

        private Color searchColor;

        public Color SearchColor
        {
            get { return searchColor; }
            set { searchColor = value; OnPropertyChanged("SearchColor"); }
        }

        public override void Execute(DataModel data, SearchService searchService)
        {
            if (Search)
            {
                searchService.SearchedItems.Add(new SearchDateTimeRequest()
                {
                    DateTime = dateTime,
                    Color1 = SearchColor,
                    SearchInGaps = true
                });
            }
        }
    }
}